home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / librw / RWTValMultiMapIterator.z / RWTValMultiMapIterator
Encoding:
Text File  |  1998-10-30  |  7.5 KB  |  199 lines

  1.  
  2.  
  3.  
  4. RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))                      RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))
  5.  
  6.  
  7.  
  8. NNNNaaaammmmeeee
  9.      RWTValMultiMapIterator<K,T,C> - Rogue Wave library class
  10.  
  11. SSSSyyyynnnnooooppppssssiiiissss
  12.               #include<rw/tvmmap.h>
  13.  
  14.  
  15.  
  16.               RWTValMultiMap<K,T,C> vm;
  17.           RWTValMultiMapIterator<K,T,C> itr(vm);
  18.  
  19. SSSSttttaaaannnnddddaaaarrrrdddd CCCC++++++++ LLLLiiiibbbbrrrraaaarrrryyyy DDDDeeeeppppeeeennnnddddeeeennnntttt!!!!
  20.      RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr requires the Standard C++ Library.
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. DDDDeeeessssccccrrrriiiippppttttiiiioooonnnn
  28.      RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr is supplied with TTTToooooooollllssss....hhhh++++++++ 7 to provide an
  29.      iterator interface for class RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp that has backward
  30.      compatibility with the container iterators provided in TTTToooooooollllssss....hhhh++++++++ 6.x. The
  31.      order of iteration for an RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp is dependent upon the comparator
  32.      object as applied to the keys of the stored associations.  The current
  33.      item referenced by this iterator is undefined after construction or after
  34.      a call to rrrreeeesssseeeetttt(((())))....  The iterator becomes valid after being advanced with
  35.      either a preincrement or ooooppppeeeerrrraaaattttoooorrrr(((()))).  For both ooooppppeeeerrrraaaattttoooorrrr++++++++ and ooooppppeeeerrrraaaattttoooorrrr(((()))),
  36.      iterating past the last element will return a value equivalent to boolean
  37.      ffffaaaallllsssseeee.  Continued increments will return a value equivalent to ffffaaaallllsssseeee
  38.      until rrrreeeesssseeeetttt(((()))) is called.
  39.  
  40. PPPPeeeerrrrssssiiiisssstttteeeennnncccceeee
  41.      None
  42.  
  43. EEEExxxxaaaammmmpppplllleeeessss
  44.               #include<rw/tvmmap.h>
  45.  
  46.  
  47.  
  48.               #include<iostream.h>
  49.           #include<rw/cstring.h>
  50.           int main(){
  51.              RWTValMultiMap<RWCString,int,greater<RWCString> > a;
  52.              RWTValMultiMapIterator
  53.                 <RWCString,int,greater<RWCString> > itr(a);
  54.              a.insert("John", 30);
  55.              a.insert("Steve",17);
  56.              a.insert("Mark",24);
  57.              a.insert("Steve",24);
  58.              for(;itr();)
  59.                cout << itr.key() << "'s age is " << itr.value() << endl;
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))                      RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))
  71.  
  72.  
  73.  
  74.              return 0;
  75.           }
  76.           Program Output
  77.           Steve's age is 17
  78.           Steve's age is 24
  79.           Mark's age is 24
  80.  
  81. PPPPuuuubbbblllliiiicccc CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
  82.      John's age is 30
  83.  
  84.  
  85.  
  86.               RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr<<<<KKKK,,,,TTTT,,,,CCCC>>>>
  87.  
  88.  
  89.  
  90.               (RWTValMultiMap<K,T,C>&m);
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.      Creates an iterator for the multi-map mmmm.  The iterator begins in an
  98.      undefined state and must be advanced before the first association will be
  99.      accessible.
  100.  
  101. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr OOOOppppeeeerrrraaaattttoooorrrrssss
  102.               RWBoolean
  103.           ooooppppeeeerrrraaaattttoooorrrr(((())))();
  104.  
  105.  
  106.      Advances self to the next element.  If the iterator has advanced past the
  107.      last item in the collection,  returns ffffaaaallllsssseeee. Otherwise, returns ttttrrrruuuueeee.
  108.  
  109.               RWBoolean
  110.           ooooppppeeeerrrraaaattttoooorrrr++++++++();
  111.  
  112.  
  113.      Advances self to the next element.  If the iterator has been reset or
  114.      just created self will now reference the first element.  If, before
  115.      iteration, self referenced the last association in the multi-map, self
  116.      will now reference an undefined value and ffffaaaallllsssseeee will be returned.
  117.      Otherwise, ttttrrrruuuueeee is returned. Note: no postincrement operation is
  118.      provided.
  119.  
  120. PPPPuuuubbbblllliiiicccc MMMMeeeemmmmbbbbeeeerrrr FFFFuuuunnnnccccttttiiiioooonnnnssss
  121.               RWTValMultiMap<K,T,C>*
  122.           ccccoooonnnnttttaaaaiiiinnnneeeerrrr(((()))) const;
  123.  
  124.  
  125.      Returns a pointer to the collection being iterated over.
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))                      RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaappppIIIItttteeeerrrraaaattttoooorrrr((((3333CCCC++++++++))))
  137.  
  138.  
  139.  
  140.               K
  141.           kkkkeeeeyyyy() const;
  142.  
  143.  
  144.      Returns the key portion of the association currently referenced by sssseeeellllffff.
  145.  
  146.               void
  147.           rrrreeeesssseeeetttt();
  148.           void
  149.           rrrreeeesssseeeetttt(RWTValMultiMap<K,T,C>& h);
  150.  
  151.  
  152.      Resets the iterator so that after being advanced it will reference the
  153.      first element of the collection.  Using rrrreeeesssseeeetttt(((()))) with no argument will
  154.      reset the iterator on the current container.  Supplying a RRRRWWWWTTTTVVVVaaaallllMMMMuuuullllttttiiiiMMMMaaaapppp
  155.      to rrrreeeesssseeeetttt(((()))) will reset the iterator on the new container.
  156.  
  157.               T
  158.           vvvvaaaalllluuuueeee();
  159.  
  160.  
  161.      Returns the value portion of the association referenced by sssseeeellllffff.
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.